package ${content.items.controller.packageName};
<#assign assign_EntityName = content.items.entity.className>
<#assign tableName = content.content.tableName>
<#assign lowerName = content.content.lowerName>
<#assign camelName = content.content.camelName>
import java.util.List;
import io.swagger.annotations.Api;
import com.ibp.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.ibp.common.core.controller.BaseController;
import com.ibp.common.core.domain.AjaxResult;
import ${content.items.service.packageName}.${content.items.service.className};
import ${content.items.entity.packageName}.${assign_EntityName};

/**
 * ${tableName}相关操作
 * @author ist
 */
@Api(tags = "${content.content.lowerName}表相关操作")
@RestController
<#list "${content.items.controller.packageName}"?split(".") as package>
<#if package!="com" && package!="ibp" && package!="controller">
@RequestMapping("/${package}/${content.content.lowerName}")
</#if>
</#list>
public class ${content.items.controller.className} extends BaseController{
	@Autowired
	private ${content.items.service.className} ${camelName}Service;

	/**
	* 获取列表
	*/
	@PostMapping(value = "/query${camelName?cap_first}List")
	public TableDataInfo query${camelName?cap_first}List(@RequestBody ${assign_EntityName} ${camelName}) {
		startPage();
		return getDataTable(${camelName}Service.query${camelName?cap_first}List(${camelName}));
	}

	<#if content.content.primaryField??>
	<#assign assign_fieldType = content.content.primaryField[0].fieldType>
	<#assign assign_fieldName = content.content.primaryField[0].fieldName>
	/**
	* 获取详情
	*/
	@GetMapping(value = "/{${assign_fieldName}}")
	public AjaxResult query${camelName?cap_first}(@PathVariable("${assign_fieldName}") ${assign_fieldType} ${assign_fieldName}) {
		return AjaxResult.success(${camelName}Service.query${camelName?cap_first}(${assign_fieldName}));
	}

	/**
	* 新增数据
	*/
	@PostMapping(value = "/add${camelName?cap_first}")
	public AjaxResult add${camelName?cap_first}(@RequestBody ${assign_EntityName} ${camelName}) {
		${camelName}Service.add${camelName?cap_first}(${camelName});
		return AjaxResult.success();
	}

	/**
	* 更新数据
	*/
	@PutMapping(value = "/modify${camelName?cap_first}")
	public AjaxResult modify${camelName?cap_first}(@RequestBody ${assign_EntityName} ${camelName}) {
		${camelName}Service.modify${camelName?cap_first}(${camelName});
		return AjaxResult.success();
	}

	/**
	* 删除数据
	*/
	@DeleteMapping(value = "/{${assign_fieldName}}")
	public AjaxResult delete${camelName?cap_first}(@PathVariable("${assign_fieldName}") ${assign_fieldType} ${assign_fieldName}) {
		${camelName}Service.delete${camelName?cap_first}(${assign_fieldName});
		return AjaxResult.success();
	}
	</#if>

}
